<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>检查任务管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function addRow(list, idx, tpl, row){
			$(list).append(Mustache.render(tpl, {
				idx: idx, delBtn: true, row: row
			}));
			$(list+idx).find("select").each(function(){
				$(this).val($(this).attr("data-value"));
			});
			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
				var ss = $(this).attr("data-value").split(',');
				for (var i=0; i<ss.length; i++){
					if($(this).val() == ss[i]){
						$(this).attr("checked","checked");
					}
				}
			});
		}
		function delRow(obj, prefix){
			var id = $(prefix+"_id");
			var delFlag = $(prefix+"_delFlag");
			if (id.val() == ""){
				$(obj).parent().parent().remove();
			}else if(delFlag.val() == "0"){
				delFlag.val("1");
				$(obj).html("&divide;").attr("title", "撤销删除");
				$(obj).parent().parent().addClass("error");
			}else if(delFlag.val() == "1"){
				delFlag.val("0");
				$(obj).html("&times;").attr("title", "删除");
				$(obj).parent().parent().removeClass("error");
			}
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/jcxx/drJcxx/form?id=${drJcxx.id}">检查计划<shiro:hasPermission name="jcxx:drJcxx:edit">${not empty drJcxx.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="jcxx:drJcxx:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
    <form:form id="inputForm" modelAttribute="drJcxx" action="${ctx}/jcxx/drJcxx/save" method="post" class="form-horizontal">
    <div class="control-group">
    	<label class="control-label"></label>
        <div class="controls">
            <table id="contentTable" class="table table-striped table-bordered table-condensed" style="width:80%;">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>“双随机事件”</th>
                    </tr>
                </thead>
                <tbody>
                    <tr><td>1</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-管理体系和服务认证专项监督检查</a></td></tr>
                    <tr><td>2</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-CCC获证产品市场抽查</a></td></tr>
                    <tr><td>3</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-食用农产品获认证产品监督抽查</a></td></tr>
                    <tr><td>4</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-国境口岸储存场地（库）卫生监督</td></tr>
                    <tr><td>5</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-进境非食用动物产品指定企业日常监督}</a></td></tr>
                    <tr><td>6</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-进境粮食生产加工企业日常监管</a></td></tr>
                    <tr><td>7</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-出境竹木草制品注册企业日常监管</a></td></tr>
                    <tr><td>8</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-出境饲料添加剂（不含动植物源性成分）注册登记企业日常监管</a></td></tr>
                    <tr><td>9</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-法定检验以外进出口商品的抽查检验</a></td></tr>
                    <tr><td>10</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-备案出口食品原料种植场现场审核和监督检查</a></td></tr>
                    <tr><td>11</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-备案出口食品原料养殖场现场审核和监督检查</a></td></tr>
                    <tr><td>12</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-备案出口食品生产企业质量安全管理体系运行情况监督检查</a></td></tr>
                    <tr><td>13</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-已获得备案的进口食品进口商监督抽查（备案信息、进口和销售记录）</a></td></tr>
                    <tr><td>14</td><td><a href="${ctx}/jcxx/drJcxx/newtask">天津局-自定义抽查检查</a></td></tr>
                </tbody>
            </table> 
        </div>
    </div>   
	
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
<%--		<div class="control-group">
			<label class="control-label">法定事项：</label>
			<div class="controls">
				<form:input path="fdsx" htmlEscape="false" maxlength="10" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">计划名称：</label>
			<div class="controls">
				<form:input path="jhmc" htmlEscape="false" maxlength="255" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">计划日期起：</label>
			<div class="controls">
				<input name="jhrqs" type="text" readonly maxlength="20" class="input-medium Wdate "
					value="<fmt:formatDate value="${drJcxx.jhrqs}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">计划日起止：</label>
			<div class="controls">
				<input name="jhrqz" type="text" readonly maxlength="20" class="input-medium Wdate "
					value="<fmt:formatDate value="${drJcxx.jhrqz}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">计划制定单位：</label>
			<div class="controls">
				<form:input path="office.id" htmlEscape="false" maxlength="64" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">执法小组数量：</label>
			<div class="controls">
				<form:input path="jhxzsl" htmlEscape="false" maxlength="10" class="input-xlarge  digits"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">每组人数：</label>
			<div class="controls">
				<form:input path="xzrs" htmlEscape="false" maxlength="10" class="input-xlarge  digits"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">执法对象数目：</label>
			<div class="controls">
				<form:input path="dxsl" htmlEscape="false" maxlength="10" class="input-xlarge  digits"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">抽取对象分组数量：</label>
			<div class="controls">
				<form:input path="dxfz" htmlEscape="false" maxlength="10" class="input-xlarge  digits"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">执法对象类别：</label>
			<div class="controls">
				<form:input path="dxlb" htmlEscape="false" maxlength="10" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">问题数量：</label>
			<div class="controls">
				<form:input path="wtsl" htmlEscape="false" maxlength="10" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">问题企业数量：</label>
			<div class="controls">
				<form:input path="wtqysl" htmlEscape="false" maxlength="10" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">问题总结：</label>
			<div class="controls">
				<form:input path="wtms" htmlEscape="false" maxlength="2000" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">标志：</label>
			<div class="controls">
				<form:input path="flag" htmlEscape="false" maxlength="10" class="input-xlarge "/>
			</div>
		</div>
			<div class="control-group">
				<label class="control-label">检查小组：</label>
				<div class="controls">
					<table id="contentTable" class="table table-striped table-bordered table-condensed">
						<thead>
							<tr>
								<th class="hide"></th>
								<th>小组序号</th>
								<th>小组名称</th>
								<th>小组长ID</th>
								<th>小组长姓名</th>
								<shiro:hasPermission name="jcxx:drJcxx:edit"><th width="10">&nbsp;</th></shiro:hasPermission>
							</tr>
						</thead>
						<tbody id="drJcxzList">
						</tbody>
						<shiro:hasPermission name="jcxx:drJcxx:edit"><tfoot>
							<tr><td colspan="6"><a href="javascript:" onClick="addRow('#drJcxzList', drJcxzRowIdx, drJcxzTpl);drJcxzRowIdx = drJcxzRowIdx + 1;" class="btn">新增</a></td></tr>
						</tfoot></shiro:hasPermission>
					</table>
					<script type="text/template" id="drJcxzTpl">//<!--
						<tr id="drJcxzList{{idx}}">
							<td class="hide">
								<input id="drJcxzList{{idx}}_id" name="drJcxzList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
								<input id="drJcxzList{{idx}}_delFlag" name="drJcxzList[{{idx}}].delFlag" type="hidden" value="0"/>
							</td>
							<td>
								<input id="drJcxzList{{idx}}_xzxh" name="drJcxzList[{{idx}}].xzxh" type="text" value="{{row.xzxh}}" maxlength="10" class="input-small "/>
							</td>
							<td>
								<input id="drJcxzList{{idx}}_xzmc" name="drJcxzList[{{idx}}].xzmc" type="text" value="{{row.xzmc}}" maxlength="255" class="input-small "/>
							</td>
							<td>
								<input id="drJcxzList{{idx}}_user" name="drJcxzList[{{idx}}].user.id" type="text" value="{{row.user.id}}" maxlength="64" class="input-small "/>
							</td>
							<td>
								<input id="drJcxzList{{idx}}_xzzmc" name="drJcxzList[{{idx}}].xzzmc" type="text" value="{{row.xzzmc}}" maxlength="255" class="input-small "/>
							</td>
							<shiro:hasPermission name="jcxx:drJcxx:edit"><td class="text-center" width="10">
								{{#delBtn}}<span class="close" onclick="delRow(this, '#drJcxzList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
							</td></shiro:hasPermission>
						</tr>//-->
					</script>
					<script type="text/javascript">
						var drJcxzRowIdx = 0, drJcxzTpl = $("#drJcxzTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
						$(document).ready(function() {
							var data = ${fns:toJson(drJcxx.drJcxzList)};
							for (var i=0; i<data.length; i++){
								addRow('#drJcxzList', drJcxzRowIdx, drJcxzTpl, data[i]);
								drJcxzRowIdx = drJcxzRowIdx + 1;
							}
						});
					</script>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">检查执法记录：</label>
				<div class="controls">
					<table id="contentTable" class="table table-striped table-bordered table-condensed">
						<thead>
							<tr>
								<th class="hide"></th>
								<th>执法对象ID</th>
								<th>执法对象名称</th>
								<th>问题描述</th>
								<th>是否合格</th>
								<th>处罚类型</th>
								<th>是否为失信依据</th>
								<th>提出人ID</th>
								<th>提出人姓名</th>
								<th>备注信息</th>
								<shiro:hasPermission name="jcxx:drJcxx:edit"><th width="10">&nbsp;</th></shiro:hasPermission>
							</tr>
						</thead>
						<tbody id="drJczfjlList">
						</tbody>
						<shiro:hasPermission name="jcxx:drJcxx:edit"><tfoot>
							<tr><td colspan="11"><a href="javascript:" onClick="addRow('#drJczfjlList', drJczfjlRowIdx, drJczfjlTpl);drJczfjlRowIdx = drJczfjlRowIdx + 1;" class="btn">新增</a></td></tr>
						</tfoot></shiro:hasPermission>
					</table>
					<script type="text/template" id="drJczfjlTpl">//<!--
						<tr id="drJczfjlList{{idx}}">
							<td class="hide">
								<input id="drJczfjlList{{idx}}_id" name="drJczfjlList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
								<input id="drJczfjlList{{idx}}_delFlag" name="drJczfjlList[{{idx}}].delFlag" type="hidden" value="0"/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_drZfdx" name="drJczfjlList[{{idx}}].drZfdx.id" type="text" value="{{row.drZfdx.id}}" maxlength="64" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_drZfdxDxmc" name="drJczfjlList[{{idx}}].drZfdxDxmc" type="text" value="{{row.drZfdxDxmc}}" maxlength="255" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_wtms" name="drJczfjlList[{{idx}}].wtms" type="text" value="{{row.wtms}}" maxlength="255" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_sfhg" name="drJczfjlList[{{idx}}].sfhg" type="text" value="{{row.sfhg}}" maxlength="1" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_cflx" name="drJczfjlList[{{idx}}].cflx" type="text" value="{{row.cflx}}" maxlength="10" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_sfsxyj" name="drJczfjlList[{{idx}}].sfsxyj" type="text" value="{{row.sfsxyj}}" maxlength="1" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_jcryid" name="drJczfjlList[{{idx}}].jcryid" type="text" value="{{row.jcryid}}" maxlength="64" class="input-small "/>
							</td>
							<td>
								<input id="drJczfjlList{{idx}}_jcrymc" name="drJczfjlList[{{idx}}].jcrymc" type="text" value="{{row.jcrymc}}" maxlength="255" class="input-small "/>
							</td>
							<td>
								<textarea id="drJczfjlList{{idx}}_remarks" name="drJczfjlList[{{idx}}].remarks" rows="4" maxlength="255" class="input-small ">{{row.remarks}}</textarea>
							</td>
							<shiro:hasPermission name="jcxx:drJcxx:edit"><td class="text-center" width="10">
								{{#delBtn}}<span class="close" onclick="delRow(this, '#drJczfjlList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
							</td></shiro:hasPermission>
						</tr>//-->
					</script>
					<script type="text/javascript">
						var drJczfjlRowIdx = 0, drJczfjlTpl = $("#drJczfjlTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
						$(document).ready(function() {
							var data = ${fns:toJson(drJcxx.drJczfjlList)};
							for (var i=0; i<data.length; i++){
								addRow('#drJczfjlList', drJczfjlRowIdx, drJczfjlTpl, data[i]);
								drJczfjlRowIdx = drJczfjlRowIdx + 1;
							}
						});
					</script>
				</div>
			</div>--%>
		<div class="form-actions">
			<%--<shiro:hasPermission name="jcxx:drJcxx:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>--%>
			<input id="btnCancel" class="btn" type="button" value="返 回" onClick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>